#include <stdio.h>错误在哪

来源:百度知道 编辑:UC知道 时间:2024/06/01 21:36:30
#include <stdio.h>
void main()
{int space,B,others;
char c;
space=0,B=0,others=0;
printf("请输入一行字符:\n");
while ((c=gets char()))!='\n')
{
if(C=='\n')
space++;
if(c=='\n')
B++;
else
others++;
}
printf ("空格数 :%d\n,换行字符:%d\n,其他字符:%d\n",space,B,others);
}

while ((c=gets char()))!='\n')
这个不正确,第一,小括号不匹配,左括号多了;第二,gets char是什么东西?应该是getchar()吧。

另外,注意到程序中,c既有大写也有小写,在C语言里,大小写是敏感的,不能乱变化。